package cn.sunagy.security.maz.gate.server;

import cn.sunagy.maz.gate.ratelimit.EnableMazGateRateLimit;
import cn.sunagy.maz.gate.ratelimit.config.IUserPrincipal;
import cn.sunagy.security.maz.auth.client.EnableMazAuthClient;
import cn.sunagy.security.maz.gate.server.config.UserPrincipal;
import cn.sunagy.security.maz.gate.server.utils.DBLog;
import com.spring4all.swagger.EnableSwagger2Doc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@EnableDiscoveryClient
@EnableZuulProxy
@EnableScheduling
@EnableSwagger2Doc
@EnableMazAuthClient
@EnableMazGateRateLimit
@EnableFeignClients({"cn.sunagy.security.maz.auth.client.feign","cn.sunagy.security.maz.gate.server.feign"})
public class MazGateServerApplication {

	public static void main(String[] args) {
        DBLog.getInstance().start();
		SpringApplication.run(MazGateServerApplication.class, args);
	}

	@Bean
	@Primary
	IUserPrincipal userPrincipal(){
		return new UserPrincipal();
	}
}
